package service1;

import beans1.Doctorbean;
import db1.DoctorDAO;

import java.sql.SQLException;
import java.util.ArrayList;

public class DoctorService {
    public ArrayList<Doctorbean> browse(){
        DoctorDAO dao =new DoctorDAO();
        return  dao.getAllRecords();
    }


    public int delDoctor(Doctorbean user)
    {
        DoctorDAO userDao=new DoctorDAO();
        if(userDao.deleteRecord(user))
            return 1;
        else
            return 2;
    }
    public boolean editDoctor(Doctorbean user) throws SQLException {
        DoctorDAO userDao=new DoctorDAO();
        System.out.println("in editDoctor Service");
        if(userDao.editDoctor(user))
            return true;
        else
            return false;
    }

    public boolean insertDoctor(Doctorbean user) throws SQLException {
        DoctorDAO userDao=new DoctorDAO();
        if(userDao.insertDoctor(user))
            return true;
        else
            return false;
    }
}
